import { ApiProperty, ApiPropertyOptional} from '@nestjs/swagger';
import { Exebook } from 'src/modules/questionbank/exebook/entities/exebook.entity';

//数据验证（核心功能）
export class CreateTrainingtaskDto {
  @ApiProperty({ description: '训练任务名称', example: '训练任务1' })
  name: string;

  @ApiProperty({
    description:'是否线上培训:0-否,1-是）',
    example: 0,
    enum:[0,1]
  })
  isOnline: number;

  @ApiProperty({
    description:'培训开始时间',
    example:'2021-10-10 10:00:00'
  })
  startTime: string;

  @ApiProperty({
    description:'培训结束时间',
    example:'2021-10-11 10:00:00'
  })
  endTime: string;

  @ApiProperty({
    description:'是否包含考试:0-否 1-是',
    example: 1,
    enum:[0,1]
  })
  hasExam: number;

  @ApiProperty({
    description:'是否使用题库: 0-否 1-是',
    example: 1,
    enum:[0,1]
    })
    useQuestionBank: number;

  @ApiProperty({
    description:'考试题目组成配置',
    example:{
      questionTypes: [
        { type: 1, count: 10 },
        { type: 2, count: 5 }
      ],
      isRandom: true
      }
    })
  questionComposition: {
    questionTypes: {
      type: number;
      count: number;
    }[];
    isRandom: boolean;
  };


 @ApiProperty({
    description:'关联题库ID数组 (当useQuestionBank=1时使用)',
    type: [Number],
    example: [101, 102]
 })
 exebookIds: number[];

@ApiPropertyOptional({ 
    description: '补考及格分数 (当allowRetry=1时使用)', 
    example: 60,
    minimum: 0,
    maximum: 100
  })
 makeupPassingScore?: number;

 @ApiProperty({ description:'考试次数', example: 2, minimum: 1, maximum: 10 })
 examTimes: number;

 @ApiProperty({description:'关联岗位ID',example: '1'})
 dutyId: string;
 @ApiProperty({description:'关联业务ID',example: '1'})
 deptId: string;

 @ApiProperty({description:'及格分数',example: 60,minimum: 0,maximum: 100})
 passingScore: number;
 @ApiProperty({description:'是否允许重考',example: 1,enum:[0,1]})
 allowRetry: number;

 @ApiProperty ({description:'发布范围配置',type:[Object],
    example:[{deptId:['1','2'],dutyId:['1','2']}]})
 publishScope: Array<{
  dept?: string[];
  duty?: string[];
}>;

  }
